package cn.zcy.springboot_web.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;

import java.util.Date;

@ApiModel(description = "用户对象")
public class User {
    @JsonIgnore
    private Integer id;
    @JsonProperty(value = "uname")
    private String userName;
    private Integer age;
    @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss",locale = "zh")
    @JsonInclude(JsonInclude.Include.NON_NULL)//属性不为空时 格式化
    private Date birthday;

    public User() {
    }

    public User(Integer id, String userName, Integer age) {
        this.id = id;
        this.userName = userName;
        this.age = age;
    }

    public User(Integer id, String userName, Integer age, Date birthday) {
        this.id = id;
        this.userName = userName;
        this.age = age;
        this.birthday = birthday;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public User(int i, String s) {
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", userName='" + userName + '\'' +
                ", age=" + age +
                '}';
    }
}
